#include "headfile.h"

void remind(uint16_t time)
{
	LED1_TOGGLE;
	LED2_TOGGLE;
	LED3_TOGGLE;
	LED4_TOGGLE;
	LED5_TOGGLE;
	LED6_TOGGLE;
	LED7_TOGGLE;
	LED8_TOGGLE;

	delay_ms(time);

	LED1_TOGGLE;
	LED2_TOGGLE;
	LED3_TOGGLE;
	LED4_TOGGLE;
	LED5_TOGGLE;
	LED6_TOGGLE;
	LED7_TOGGLE;
	LED8_TOGGLE;

	delay_ms(time);
}


// void remind(uint8_t time)
// {
// 	LED1_ON;
// 	LED2_ON;
// 	LED3_ON;
// 	LED4_ON;
// 	LED5_ON;
// 	LED6_ON;
// 	LED7_ON;
// 	LED8_ON;
// 	BUZZER_ON;

// 	delay_ms(time);

// 	LED1_OFF;
// 	LED2_OFF;
// 	LED3_OFF;
// 	LED4_OFF;
// 	LED5_OFF;
// 	LED6_OFF;
// 	LED7_OFF;
// 	LED8_OFF;
// 	BUZZER_OFF;

// 	delay_ms(time);
// }


void led_remind(uint16_t time)
{
	LED1_TOGGLE;	
	LED2_TOGGLE;
	LED3_TOGGLE;
	LED4_TOGGLE;
 	LED5_TOGGLE;
	LED6_TOGGLE;
	LED7_TOGGLE;
	LED8_TOGGLE;
	delay_ms(time);


	LED1_TOGGLE;
	LED2_TOGGLE;
	LED3_TOGGLE;
	LED4_TOGGLE;
 	LED5_TOGGLE;
	LED6_TOGGLE;
	LED7_TOGGLE;
	LED8_TOGGLE;

	delay_ms(time);
}

void buzzer_remind(uint16_t time)
{
	BUZZER_ON;
	delay_ms(time);
	BUZZER_OFF;
	delay_ms(time);
}

uint8_t sound_light_remind_flag = 0;
uint8_t sound_light_remind_count = 0;
uint8_t sound_light_remind_finish_flag = 0;
uint8_t last_state;
void sound_light_remind()
{
	if(sound_light_remind_flag == 1 && sound_light_remind_count < 10 && last_state != state_num)
	{
			sound_light_remind_finish_flag = 0;
			LED1_TOGGLE;	
			LED2_TOGGLE;
			LED3_TOGGLE;
			LED4_TOGGLE;
			LED5_TOGGLE;
			LED6_TOGGLE;
			LED7_TOGGLE;
			LED8_TOGGLE;
			BUZZER_ON;
		
			sound_light_remind_count ++;
	}
	else if(sound_light_remind_finish_flag == 0)
	{
		sound_light_remind_flag = 0;
		sound_light_remind_count = 0;
		BUZZER_OFF;
		sound_light_remind_finish_flag = 1;
		last_state = state_num;
	}
}